//
//  STEternalScrollViewController.swift
//  iPhone
//
//  Created by Toj on 7/26/22.
//

import Foundation

// 轮寻视图
class STEternalScrollViewController: STBaseViewController {
    
    private lazy var eternalScrollView: STEternalScrollView = {
       let view = STEternalScrollView()
        view.timeInterval = 2
        view.pageControl.backgroundColor = .black.withAlphaComponent(0.3)
        view.pageControl.currentPageIndicatorColor = .orange
        view.pageControl.pageIndicatorColor = .gray
        view.pageControl.indicatorWidth = 10
        view.pageControl.indicatorMargin = 10
        return view
    }()
    
    // let images = [ LBModel(name: "img_00")
    // "img_00", "img_01", "img_02","img_03", "img_04"
    // ]
    
    let images = [
        LBModel(name: "img_00"),
        LBModel(name: "img_01"),
        LBModel(name: "img_02"),
        LBModel(name: "img_03"),
        LBModel(name: "img_04")
                ]
                
    override func viewDidLoad() {
        super.viewDidLoad()

        tt_isNavigationBarHidden = true
        
        eternalScrollView.register(viewClass: LBView.self)
        eternalScrollView.frame = CGRect(x: 30, y: 50, width: 300, height: 130);
        eternalScrollView.datasource = images
        eternalScrollView.delegate = self
        view.addSubview(eternalScrollView)
    }
}

extension STEternalScrollViewController: STEternalScrollViewDelegate {
    func eternalScrollView(_ view: STEternalScrollView, didTapSelected index: Int) {
        // print("-->toj: index:\(index), value: \(images[index])")
    }
}

